import { seq } from "../db"
import { DataTypes, Model, Optional } from "sequelize"
import * as path from "path"
//权限等级分两种，一种最高权限，一种普通权限
enum roleType {
    BOSS = "boss",
    ADMIN = "admin"
}
const roles = ["admin", "boss"]

interface IGameBase {
    DM_nickname: string
    DM_id: string
    role: any
    isOver:boolean
    is_deleted?: boolean
}

interface IGameInstance extends Model {
    // id:number
    DM_nickname: string
    DM_id: number
    scriptName:string
    scriptId: number
    role: any
    isOver:boolean
    is_deleted?: boolean

}








const GameModel = seq.define('Game', {
    // 在这里定义模型属性
    DM_nickname: {
        type: DataTypes.STRING,
        comment: "dm昵称",
        allowNull: false
    },
    DM_id: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: "密码"
        // allowNull 默认为 true
    },
    role: {
        type: DataTypes.JSON,
       
        comment: "role"
    },
    scriptName: {
        type: DataTypes.STRING,
        allowNull: false
    },
    scriptId: {
        type: DataTypes.INTEGER,
        allowNull: false
    },
    isOver:{
        type:DataTypes.BOOLEAN,
        defaultValue:false,
    },
    is_deleted: {
        type: DataTypes.BOOLEAN,
        defaultValue: false,
        comment: "是否删除，默认不删除"

    }

}, {
    // 这是其他模型参数
    tableName: 'games'
});






export {
    GameModel,
    IGameInstance,
    roleType,
    IGameBase
}








